home *** CD-ROM | disk | FTP | other *** search
- Path: calf.saltfarm.bt.co.uk!not-for-mail
- From: aeb@calf.saltfarm.bt.co.uk (Tony Bass)
- Newsgroups: comp.lang.c
- Subject: Re: function pointers
- Date: 1 Feb 1996 10:37:47 -0000
- Organization: BT Speech Technology Section
- Message-ID: <4eq55r$rgs@calf.saltfarm.bt.co.uk>
- References: <4eohgr$gt0@giga.bga.com>
- Reply-To: aeb@saltfarm.bt.co.uk
- NNTP-Posting-Host: calf.saltfarm.bt.co.uk
-
- From article <4eohgr$gt0@giga.bga.com>, by makuch@bga.com (Michael Makuch):
- > In article <4eogio$gt0@giga.bga.com>, makuch@bga.com says...
- >>
- >>The following c code segment compiles and works on
- >>NT MSVC++ and on SVR4 C compiler, but errors out
- >>on AIX with a type mismatch;
- >>
- >>struct foostruct1 * myfoo1();
- >>struct foostruct2 * myfoo2();
- >>void *(*ptr)();
- >>
- >>ptr = myfoo1;
-
-
- Function-type casts are needed,
-
- ptr = (void *(*)())myfoo1;
-
- and later at the call
-
- ((struct foostruct1 *(*)())ptr)();
-
- It might be possible to make it a bit more readable with typedefs.
-
- Tony Bass
-
- --
- # Tony Bass Tel: (01473) 645305
- # MLB 3/19, BT Laboratories e-mail: aeb@saltfarm.bt.co.uk
- # Martlesham Heath, Ipswich, Suffolk, IP5 7RE DO NOT e-mail to From: line
- # Opinions are my own
-